package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class HelloController {

    @GetMapping("/greeting")
    public String greeting(@RequestParam(name="name",required = false,defaultValue = "World") String name, Model model) {
        model.addAttribute("name",name);
        return "greeting";
    }

    @RequestMapping("/greet")
    public String greet(Model mo) {
        mo.addAttribute("hi","wjcsb");
        return "greet";
    }
}
